package com.base.engine;

import com.base.engine.gui.MADUserInterface;

public final class MADMemory {
	
	private static Runtime runtime = Runtime.getRuntime(); 

	private static long maxMem ; 
	private static long totalMem ; 
	private static long freeMem ; 
	private static long totalFreeMem ; 
	
	public static void update(){
		maxMem = runtime.maxMemory() / 1024; 
		totalMem = runtime.totalMemory() / 1024; 
		freeMem = runtime.freeMemory() / 1024; 
		totalFreeMem = freeMem + (maxMem - totalMem) ; 
		
		float _maxMem = maxMem / 1024f ; 
		float _totalMem = totalMem / 1024f ; 
		float _freeMem = freeMem / 1024f ; 
		float _totalFreeMem = totalFreeMem / 1024f ; 
		
		String tmp = "Free Memory: "+_freeMem+" MB  |  "+"Allocated Memory: "+_totalMem+" MB  |  "+
						"Max. Memory: "+_maxMem+" MB  |  "+"Total free Memory: "+_totalFreeMem+" MB" ; 
		
		MADUserInterface.getDebuggingScreen().getInfo().set(2, tmp);  
	}

}
